package com.bfl.sa.showcase.tree.converter;

import com.bfl.sa.showcase.tree.entity.Tree;
import com.bfl.sa.showcase.tree.service.TreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;

public class TreeConverter implements Converter<String, Tree> {

    @Autowired
    private TreeService treeService;

    @Override
    public Tree convert(String id) {
        return treeService.findOne(Long.parseLong(id));
    }
}
